import React, {Component} from 'react';
import {
    List,
    WingBlank
} from 'antd-mobile';
import axios from 'axios';

const Item = List.Item;
export default class Data extends Component {
    constructor(props) {
        super(props);
        this.state = {
            data: {}
        }
    }

    componentDidMount() {
        axios.get('/data')
            .then((res) => {
                if (res.status === 200) {
                    let data = res.data[0];
                    this.setState({
                        data: data
                    })
                }
            });
    }

    render() {
        return (
            <div>
                <WingBlank>
                    <List renderHeader="用户数据">
                        <Item extra={this.state.data.userID}>用户ID</Item>
                        <Item extra={this.state.data.userName}>用户昵称</Item>
                        <Item extra={this.state.data.phone}>用户手机</Item>
                    </List>
                </WingBlank>
            </div>
        )
    }
}